cmake_minimum_required (VERSION 3.8)

project (vscm)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}")
MESSAGE(STATUS "THE HOME DIR: $ENV{HOME}")

MESSAGE(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
MESSAGE(STATUS "System Name: ${CMAKE_SYSTEM_NAME}")
if (MSVC)
    string(APPEND CMAKE_CXX_FLAGS  " /source-charset:utf-8 /EHsc")
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Windows")
    MESSAGE(STATUS "Add MinGW Param.")
    string(APPEND CMAKE_CXX_FLAGS  " -finput-charset=utf-8 -fexec-charset=gbk")
endif()

#  g++ .\main.cpp -std=c++17 -finput-charset=UTF-8 -fexec-charset=GBK
add_executable(vscm main.cpp)
install(TARGETS vscm DESTINATION bin)